﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using ESRI.ArcGIS.Client;

namespace Eaglight
{
    public abstract class Toolbar: Control
    {
        protected const double DEFAULT_BUTTON_WIDTH = 32;
        protected const double DEFAULT_BUTTON_HEIGHT = 32;
        protected bool controlsInitialized;
        protected Map map;

        public Toolbar()
        {
            SetValue(OrientationProperty, Orientation.Horizontal);
            SetValue(FlowDirectionProperty, FlowDirection.LeftToRight);
            SetValue(HorizontalAlignmentProperty, HorizontalAlignment.Left);
            SetValue(VerticalAlignmentProperty, VerticalAlignment.Top);
            SetValue(ButtonWidthProperty, DEFAULT_BUTTON_WIDTH);
            SetValue(ButtonHeightProperty, DEFAULT_BUTTON_HEIGHT);
        }

        protected abstract void enableToolTips();
        protected abstract void disableToolTips();

       
        #region Properties

        public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register("Orientation", typeof(Orientation), typeof(Toolbar), null);
        public static readonly DependencyProperty ButtonGradientBrushProperty = DependencyProperty.Register("ButtonGradientBrush", typeof(Brush), typeof(Toolbar), null);
        public static readonly DependencyProperty ButtonFocusBrushProperty = DependencyProperty.Register("ButtonFocusBrush", typeof(Brush), typeof(Toolbar), null);
        public static readonly DependencyProperty ButtonWidthProperty = DependencyProperty.Register("ButtonWidth", typeof(double), typeof(Toolbar), null);
        public static readonly DependencyProperty ButtonHeightProperty = DependencyProperty.Register("ButtonHeight", typeof(double), typeof(Toolbar), null);
        public static readonly DependencyProperty ButtonImageStretchProperty = DependencyProperty.Register("ButtonImageStretch", typeof(Stretch), typeof(Toolbar), null);
        public static readonly DependencyProperty ShowToolTipsProperty = DependencyProperty.Register("ShowToolTips", typeof(bool), typeof(Toolbar), null);

        public Orientation Orientation
        {
            get
            {
                return (Orientation)GetValue(OrientationProperty);
            }
            set { SetValue(OrientationProperty, value); }

        }

        public Brush ButtonGradientBrush
        {
            set
            {
                SetValue(ButtonGradientBrushProperty, value);
            }
            get
            {
                return (Brush)GetValue(ButtonGradientBrushProperty);
            }
        }

        public Brush ButtonFocusBrush
        {
            set
            {
                SetValue(ButtonFocusBrushProperty, value);
            }

            get
            {
                return (Brush)GetValue(ButtonFocusBrushProperty);
            }
        }


        public double ButtonHeight
        {
            set
            {
                SetValue(ButtonHeightProperty, value);
            }

            get
            {
                return (double)GetValue(ButtonHeightProperty);
            }
        }

        public double ButtonWidth
        {
            set
            {
                SetValue(ButtonWidthProperty, value);
            }

            get
            {
                return (double)GetValue(ButtonWidthProperty);
            }
        }

        public Stretch ButtonImageStretch
        {
            set
            {
                SetValue(ButtonImageStretchProperty, value);
            }

            get
            {
                return (Stretch)GetValue(ButtonImageStretchProperty);
            }
        }

       

        public bool ShowToolTips
        {
            get
            {
                return (bool)GetValue(ShowToolTipsProperty);
            }

            set
            {
                SetValue(ShowToolTipsProperty, value);
                if (value == true)
                {
                    enableToolTips();
                }
                else
                {
                    disableToolTips();
                }
            }
        }

        # endregion
    }

    
}
